package com.yunfeisoft.business.model;

import com.yunfeisoft.base.model.WorkflowInstance;
import com.yunfeisoft.common.base.BaseModel;
import com.yunfeisoft.common.sql.record.TransientField;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * ClassName: PurchaseGoodsApply
 * Description: 物品采购申请单
 *
 * @Author: Jackie liu
 * Date: 2020-04-01
 */
@Entity
@Table(name = "TT_PURCHASE_GOODS_APPLY")
public class PurchaseGoodsApply extends BaseModel implements Serializable {

    /**
     * Field serialVersionUID: 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 流程定义id
     */
    @Column
    private String workflowDefineId;

    /**
     * 物品名称
     */
    @Column
    private String name;

    /**
     * 规格
     */
    @Column
    private String standard;

    /**
     * 数量
     */
    @Column
    private BigDecimal quantity;

    /**
     * 用途
     */
    @Column
    private String content;

    /**
     * 询价金额
     */
    @Column
    private BigDecimal inquiryAmount;

    /**
     * 实付金额
     */
    @Column
    private BigDecimal amount;

    /**
     * 备注
     */
    @Column
    private String remark;

    /**
     * 状态
     */
    @Column
    private Integer status;

    @TransientField
    private Integer validStatus;
    @TransientField
    private String createName;
    //下一节点处理人
    private String nextStepUserId;

    public String getStatusStr() {
        return PurchaseGoodsApplyStatusEnum.valueOf(status);
    }

    public String getValidStatusStr() {
        return WorkflowInstance.WorkflowInstanceStatusEnum.valueOf(validStatus);
    }

    public String getWorkflowDefineId() {
        return workflowDefineId;
    }

    public void setWorkflowDefineId(String workflowDefineId) {
        this.workflowDefineId = workflowDefineId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStandard() {
        return standard;
    }

    public void setStandard(String standard) {
        this.standard = standard;
    }

    public BigDecimal getQuantity() {
        return quantity;
    }

    public void setQuantity(BigDecimal quantity) {
        this.quantity = quantity;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public BigDecimal getInquiryAmount() {
        return inquiryAmount;
    }

    public void setInquiryAmount(BigDecimal inquiryAmount) {
        this.inquiryAmount = inquiryAmount;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getNextStepUserId() {
        return nextStepUserId;
    }

    public void setNextStepUserId(String nextStepUserId) {
        this.nextStepUserId = nextStepUserId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getValidStatus() {
        return validStatus;
    }

    public void setValidStatus(Integer validStatus) {
        this.validStatus = validStatus;
    }

    public enum PurchaseGoodsApplyStatusEnum {

        UNISSUED(1, "待发放"),
        ISSUED(2, "已发放");

        private int value;
        private String label;

        private PurchaseGoodsApplyStatusEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (PurchaseGoodsApplyStatusEnum loop : PurchaseGoodsApplyStatusEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }


        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }

    }
}